<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;

class CreateClassesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('class', function (Blueprint $table) {
            $table->id();
            $table->string('name', 35)->default('')->comment('班级名称');
            $table->unsignedInteger('number')->default(0)->comment('班级人数');
            $table->text('teaching_material')->comment('教材');
            $table->unsignedInteger('mechanism_id')->default(0)->comment('所属机构');
            $table->timestamp('begin_at')->nullable()->comment('开学时间');
            $table->timestamps();
        });
        DB::statement("ALTER TABLE `class` comment '班级表'");
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('class');
    }
}
